import Taro, { Component } from '@tarojs/taro'
import { Swiper, SwiperItem, Image, View, Text } from '@tarojs/components'
import '../../assets/common.scss'
import CommonJs from '../../utils/common'
import '../../assets/animate.min.scss'
import './mall.scss'
import score from '../../assets/kedouimg01/vip3.png'
import lbicon from '../../assets/kedouimg01/lbicon.png'
import lbicon2 from '../../assets/kedouimg01/lbicon2.png'


import line from '../../assets/kedouimg01/line.jpg'

export default class Index extends Component {
  constructor(props) {
    super(props);
    this.state = {
       width:320,
	   paytype:125,
	   goodslist:[],
	   kdf:0,
	   total:0,
     ytotal:0,
	   address:'',
	   weight:0,
     number:0,
     verificationCode:'',
     yhqname:'',
     member:{level:{discount:0}},
     malltype:'',
     inventoryType:'PHYSICAL',
     zftype:0,
     paypwd:[],
     paypwdlen:0,
     appmark:CommonJs.getmark(),
     tuitable:[{number:'1',tuibg:false,innerhtml:false,click:'1'},
                {number:'2',tuibg:false,innerhtml:false,click:'1'},
                {number:'3',tuibg:false,innerhtml:false,click:'1'},
                {number:'4',tuibg:false,innerhtml:false,click:'1'},
                {number:'5',tuibg:false,innerhtml:false,click:'1'},
                {number:'6',tuibg:false,innerhtml:false,click:'1'},
                {number:'7',tuibg:false,innerhtml:false,click:'1'},
                {number:'8',tuibg:false,innerhtml:false,click:'1'},
                {number:'9',tuibg:false,innerhtml:false,click:'1'},
                {number:'-',tuibg:true,innerhtml:false,click:'3'},
                {number:'0',tuibg:false,innerhtml:false,click:'1'},
                {number:'',tuibg:true,innerhtml:true,click:'2'}
              ],
     dklist:[],
      dkarr:[],
      nodk:0
	}
  }
  config = {
    navigationBarTitleText: '提交订单'
  }

  open(url,type){
    this.$preload({
      type:type
    })
    CommonJs.openTo(url);
  }


  componentWillMount () {
	var par=this.$router.preload.type;
	console.log(JSON.stringify(par))
	var total=0;
	var weight=0;
  var number=0;
	for(var i=0;i<par.length;i++){
	  total=total+ par[i].price*par[i].amount
	  weight=weight+par[i].weight*par[i].amount
    number=number+par[i].amount;
	}
	if(par[0].malltype=='UC'){
		var paytype=12
	}
	else if(par[0].malltype=='WUC'){
		var paytype=10
	}
	else{
		var paytype=125
	}
	var _this=this;
	this.setState({
		goodslist:par,
		total:total,
		ytotal:total,
		weight:weight,
	    number:number,
	    malltype:par[0].malltype,
	    paytype:paytype
	},function(){
		_this.getaddress()
		
	})
	
  }


  componentDidMount () {}

  componentWillUnmount () {}

  componentDidShow () {
    var pages = getCurrentPages();
    var Page = pages[pages.length - 1];
    var info = Page.data.data;
    if(info){
      this.setState({
        address:info
      })
      this.getkdf(info);
    }
    if(Page.data.yhq){
      var total=this.state.total;
      var _this=this;
      var yhqje=0;
      var url='/order/papi/v1.9/order-coupon/discountAmount/'+total+'/'+Page.data.yhq.ids;
      CommonJs.ajaxRequest(url,'','GET',function(res){
        yhqje=res.data;
        _this.setState({
          verificationCode:Page.data.yhq.ids,
          yhqname:Page.data.yhq.name,
          ytotal:total,
          total:total-yhqje
        })
      })

    }
  }

  componentDidHide () { }
  getmember(){
  	var url='/shop/papi/v1.9/members/account/'+Taro.getStorageSync('shopId')
  	var _this=this;
    CommonJs.ajaxRequest(url,'','GET',function(res){
    	 var total=_this.state.total;
    	 if(res.data){
    	 	 total=total*res.data.level.discount/100
	       _this.setState({
	          member:res.data,
	          total:total
	        });
	        _this.getdklist(total/100)
	     }
    	 else{
    	 	_this.getdklist(total/100)
    	 }
    },'wfw')
  }
  chooseyhq(){
    if(this.state.yhqname){
      var _this=this;
      Taro.showActionSheet({
        itemList: ['选择优惠券', '不使用优惠券'],
        success(res){
          //console.log(JSON.stringify(res))
          if(res.tapIndex==0){
            _this.$preload({
            	byfrom:'order',
            	payAmount:_this.state.total,
            	shopId:Taro.getStorageSync('shopId'),
              number:_this.state.number
            })
            _this.open("/pages/mall/yhq");
          }
          else if(res.tapIndex==1){
            var ytotal=_this.state.ytotal;
            _this.setState({
              verificationCode:'',
              yhqname:'',
              total:ytotal,
            })
          }
        }
      })
    }
    else{
      this.$preload({
      	byfrom:'order',
      	payAmount:this.state.total,
      	shopId:Taro.getStorageSync('shopId')
      })
      this.open("/pages/mall/yhq");
    }

  }
  getaddress(){
	var dateinfo = Taro.getStorageSync('dateinfo')
	var url='/shop/papi/v1.9/address/first/Choice';
	var _this=this;
	CommonJs.ajaxRequest(url,'','GET',function(res){
		if(res.data){
		   _this.setState({
				address: res.data
		  })
		   _this.getkdf(res.data);
		}
	  else{
	  	var total=_this.state.total;
	  	_this.setState({
				kdf:0,
				total:total
			})
	  	_this.getmember();
	  }
	},"wfw")
  }
  getkdf(addressinfo){
	/*获取快递费*/
	var ytotal=this.state.ytotal;
	var weight=this.state.weight;
	var kdf=0;
	var url='/shop/papi/v1.9/postage/calculatePostageSigle/price?allprice='+ytotal+'&shopId='+Taro.getStorageSync('shopId')+'&cityId='+addressinfo.region.id+'&customType=STANDARD&weight='+weight;
	var _this=this;
	CommonJs.ajaxRequest(url,'','GET',function(res){
		if(res.data){
			kdf=kdf+res.data;
		}
		_this.setState({
			kdf:kdf,
			total:ytotal+kdf
		})
		_this.getmember();
	},"wfw")


  }
  choosepay(val){
	this.setState({
		paytype:val
	})
  }
  choosetype(val){
  	this.setState({
			inventoryType:val
		})
  }
  showpassword(){
  	this.setState({
			zftype:1
		})
  }
  closepay(){
    var _this = this
    _this.setState({
      zftype:0
    })
  }
  inputNum(type,event){
    var _this = this
    // console.log(JSON.stringify(event))
    // console.log(type)
    var paypwd = _this.state.paypwd
    if (type == 1) {
      var paypwdlen = paypwd.length
      if (paypwdlen < 6) {
        var num = event.target.dataset.number
        paypwd.push(num)
        var paypwdlen = paypwd.length
        _this.setState({
          paypwd:paypwd,
          paypwdlen:paypwdlen
        },function(){
          if (paypwdlen == 6) {
          
            _this.pay()
          }
        })
      }
    } else if (type == 2) {
      paypwd.pop()
      var paypwdlen = paypwd.length
      _this.setState({
        paypwd:paypwd,
        paypwdlen:paypwdlen
      })
    }
  }
  pay(){
  	var malltype=this.state.malltype;
  	var _this=this;
		var shopId = Taro.getStorageSync('shopId');
		var state=this.state;
		var dates={
		  "addressId": state.address.id,
		  "agentShopId":this.state.goodslist[0].agentShopId,
		  "businessType":1,
		  "itemList":this.state.goodslist,
		  "memberNote": "",
		  "shopId": this.state.goodslist[0].agentShopId,
		  "payTypeId":this.state.paytype,
		  inventoryType:this.state.inventoryType
		}
  	if(malltype=='UC'){
			var url='/mallbean/papi/v1.9/order';
			var orderTypeId=8
			if(dates.payTypeId!=12){
				var arr=[];
				var obj={
					payTypeId:12
				}
				arr[0]=obj;
				dates.deductionList=arr;
			}
		}
		else if(malltype=='WUC'){
			var url='/mallcredit/papi/v1.9/order';
			var orderTypeId=6
		}
		else{
			var url='/mall/papi/v1.9/order';
			var orderTypeId=1
		}
		dates.orderTypeId=orderTypeId;
	
	var dkarr=this.state.dkarr;
	var parr=[];
    if(dkarr.length>0){
    	for(var i=0;i<dkarr.length;i++){
    		var obj={
    			"payTypeId": dkarr[i]
    		}
    		parr.push(obj)
    	}
    	dates.deductionList=parr
    }
	if((this.state.paytype==10||this.state.paytype==13||this.state.paytype==12)&&this.state.paypwd.length==0){
		this.showpassword()
		return false;
	}
	else if(this.state.paytype==10||this.state.paytype==13||this.state.paytype==12){
		dates.password=this.state.paypwd.join('')
	}
	else{
		
	}
  if(this.state.verificationCode){
    dates.verificationCode=this.state.verificationCode;
  }
  if(state.goodslist[0].cartItemId){
	/*购物车买单*/
	if(malltype=='UC'){
		var url='/mallbean/papi/v1.9/order/generateCartOrder';
		if(dates.payTypeId!=12){
			var arr=[];
			var obj={
				payTypeId:12
			}
			arr[0]=obj;
			dates.deductionList=arr;
		}
	}
	else if(malltype=='WUC'){
		var url='/mallcredit/papi/v1.9/order/generateCartOrder';
	}
	else{
		var url='/mall/papi/v1.9/order/generateCartOrder';
	}
    
    dates.itemList="";
    dates.cartItemDTO=state.goodslist;
  }
  var sharearr=Taro.getStorageSync('shareCode');
  var goodslist=this.state.goodslist;
  for(var j=0;j<goodslist.length;j++){
  	var id=goodslist[j].itemId;
	  for(var i=0;i<sharearr.length;i++){
	  	if(id==sharearr[i].goodsid){
	  		var now=Date.parse(new Date())/1000;
	  		if(now-sharearr[i].time<60*60){
	  			dates.agentShopId=sharearr[i].sharcode
	  		  sharearr.splice(i, 1);
	  		}
	  	}
	  }
	}
  Taro.setStorage({key:'shareCode',data:sharearr})
	if(this.state.inventoryType!='CLOUD'&&!dates.addressId){
		Taro.showToast({
		  title:'请选择收货地址',
		  icon: 'none',
		  duration: 2000
		})
		return false;
	}
	if(dates.payTypeId==125){
		Taro.login({
			success(res) {
			  
			  if (res.code) {
				dates.code =res.code;
				CommonJs.ajaxRequest(url,dates,'POST',function(res1){
          if(res1.data.payAmount<=0){
            Taro.showToast({
              title:'购买成功,跳转中',
              icon: 'none',
              duration: 2000
            })
            setTimeout(function(){
            	if(_this.state.inventoryType=='CLOUD'){
  		 		CommonJs.open('/pages/xijia/gxc');
  		 	}
  		 	else{
              _this.$preload({
                type:'PAID'
              })
              CommonJs.open('/pages/my/unpaid');
           }
            },1000)
          }
          else{
            Taro.showToast({
              title:'下单成功,支付请求中',
              icon: 'none',
              duration: 2000
            })
            var red=res1.data;
            //console.log(red.timeStamp+'//'+red.nonceStr+'//'+red.packageValue+'//'+red.signType+'//'+red.paySign)
            setTimeout(function(){
              Taro.requestPayment({
              	appId:red.appId,
              timeStamp: red.timeStamp,
              nonceStr: red.nonceStr,
              package: red.packageValue,
              signType: red.signType,
              paySign: red.paySign,
              success(res2) {
              	if(_this.state.inventoryType=='CLOUD'){
	  		 		CommonJs.open('/pages/xijia/gxc');
	  		 	}
	  		 	else{
	                _this.$preload({
	                  type:'PAID',
	                  malltype:malltype,
	                })
	                CommonJs.open('/pages/my/unpaid');
	           }
              },
              fail() {
                Taro.showToast({
                title:'支付失败',
                icon: 'none',
                duration: 2000
                })
              }
              })
            },1000)
          }
				},'wfw')
			  } else {
				Taro.showToast({
				  title:'网络异常',
				  icon: 'none',
				  duration: 2000
				})
			  }
			}
		})
	}
	else{
		_this.setState({
	    paypwd:[],
	    paypwdlen:0
	  })
		CommonJs.ajaxRequest(url,dates,'POST',function(res1){
			
  		 Taro.showToast({
          title:'购买成功,跳转中',
          icon: 'none',
          duration: 2000
        })
  		 setTimeout(function(){
  		 	if(_this.state.inventoryType=='CLOUD'){
  		 		CommonJs.open('/pages/xijia/gxc');
  		 	}
  		 	else{
	  		 	 _this.$preload({
			        malltype:malltype,
			        type:'PAID'
			      })
	  		 	 CommonJs.open('/pages/my/unpaid');
	  		}
  		 },2000)
  		  
		},'wfw')
	}
  }
  getdklist(payAmount){
  	if(this.state.malltype){
  		return false;
  	}
  	var userid=Taro.getStorageSync('dateinfo').userid
  	var url="/order/papi/v1.9/pay/deductionMethod/"+userid+"/"+payAmount*100
  	var _this=this
  	CommonJs.ajaxRequest(url,'','GET',function(res){ 
  		var red=res.data;
  		var qunsf=payAmount*100;
  		var dkarr=_this.state.dkarr;
  		var nodk=payAmount;
  		for(var i=0;i<red.length;i++){
  			if(red[i].deductionAmount>0){
  				dkarr.push(red[i].payTypeId)
  				qunsf=qunsf-red[i].deductionAmount
  			}
  		}
  		if(qunsf<0){
  			qunsf=0
  		}
  		_this.setState({
				dklist:res.data,
				total:qunsf,
				dkarr:dkarr,
				nodk:nodk
			})
  	},'wfw')
  }
  dotype(id){
  	if(id==211){
  		if(CommonJs.getmark()=='xjzb'){
  			return '共享金'
  		}
  		else{
  			return '收益金'
  		}
  	}
  	else{
  		return '消费金'
  	}
  }
  dkchoose(index,id){
  	var dkarr=this.state.dkarr;
  	var qunsf=this.state.total;
  	var dklist=this.state.dklist;
  	var nodk=this.state.nodk*100;
  	if(dkarr.indexOf(id)>=0){
  		dkarr.splice(dkarr.indexOf(id),1)
  	}
  	else{
  		dkarr.push(id)
  	}
  	qunsf=nodk
  	for(var i=0;i<dkarr.length;i++){
  		for(var j=0;j<dklist.length;j++){
  			if(dkarr[i]==dklist[j].payTypeId){
  				qunsf=qunsf-dklist[j].deductionAmount
  			}
  		}
  	}
  	if(qunsf<0){
  		qunsf=0
  	}
  	this.setState({
			total:qunsf,
			dkarr:dkarr
		})
  }
  render () {
    const kdf=this.state.kdf;
	  const total=this.state.total;
	  const address =this.state.address;
    const member=this.state.member
    const goodslist=this.state.goodslist
    const appmark=this.state.appmark
    const dklist=this.state.dklist
    return (
      <View className='page'>
      	<View className='qun-zffixed' style={this.state.zftype==1?'display:block':'display:none'}>
          <View className='qun-zfbotn'>
            <View className='section'>
              <View className='qun-zftite'>
                <Image className='qun-zfclose' onClick={this.closepay.bind(this)} src='https://minichat.g2ma.com/kedouimg/close1.png'></Image>
                <Text>请输入支付密码</Text>
                <Text></Text>
              </View>
              <View className='qun-zfmima'>
                <View className='qun-zfkuan'>
                  <Input className='qun-zfmmyn' value={paypwdlen >= 1 ? '●' : ''} type='text' disabled='true'/>
                  <Input className='qun-zfmmyn' value={paypwdlen >= 2 ? '●' : ''} type='text' disabled='true'/>
                  <Input className='qun-zfmmyn' value={paypwdlen >= 3 ? '●' : ''} type='text' disabled='true'/>
                  <Input className='qun-zfmmyn' value={paypwdlen >= 4 ? '●' : ''} type='text' disabled='true'/>
                  <Input className='qun-zfmmyn' value={paypwdlen >= 5 ? '●' : ''} type='text' disabled='true'/>
                  <Input className='qun-zfmmyn' value={paypwdlen >= 6 ? '●' : ''} type='text' disabled='true'/>
                </View>
              </View>
              <View className='qun-zfwanji'><Text onClick={this.open.bind(this,'../my/pwdset')}>忘记密码?</Text></View>
              <View className='tui-table-view'>
                {tuitable.map((item, index) => (
                <View className={item.tuibg ? 'tui-col-3 tui-bg' : 'tui-col-3'} dataNumber={item.number} onClick={this.inputNum.bind(this,item.click)}>
                  {item.innerhtml ?
                    <Image className='qun-zfdel' src='https://minichat.g2ma.com/kedouimg/del.png'></Image>
                    :
                    item.number
                  }
                </View>
                ))}
              </View>
            </View>
          </View>
        </View>
      
        <View className='mallPage'>
        <View className='paytype' style={this.state.malltype=='UC'||(appmark!='xjzb'&&this.state.malltype!='WUC')?'padding-bottom:0;margin-bottom:20rpx;border-top:none;border-bottom: 15rpx solid #eee;':'display:none;'}>
					<View className='tit'>配送类型</View>
					<View className='qun-bmgue'>
						<View className='ps-dl' onClick={this.choosetype.bind(this,'CLOUD')}>
							<View className='ps-dt'><Image className='qun-bmbgtu' src={this.state.inventoryType=='CLOUD'?'https://minichat.g2ma.com/kedouimg/icon24.png':'https://minichat.g2ma.com/kedouimg/icon23.png'}></Image> 云仓采购</View>
							<View className='ps-dd'>可享受云仓服务:用户购买多件商品,可以分发不同收货地方,购买后请到云订单申请发货</View>
						</View>
						<View className='ps-dl' onClick={this.choosetype.bind(this,'PHYSICAL')}>
							<View className='ps-dt'><Image className='qun-bmbgtu' src={this.state.inventoryType=='PHYSICAL'?'https://minichat.g2ma.com/kedouimg/icon24.png':'https://minichat.g2ma.com/kedouimg/icon23.png'}></Image> 物流配送</View>
							<View className='ps-dd'>用户直接购买,商家直接发货</View>
							
						</View>
					</View> 
				</View>
			<View style={this.state.inventoryType=='PHYSICAL'?'':'display:none'}>	
				<View className='address' style={address==''?'display:block;':'display:none'}  onClick={this.open.bind(this,'/pages/my/address','order')}>
					<Image mode="widthFix" className='yhqjt' src="https://minichat.g2ma.com/kedouimg/goselect.png"></Image>
					<Text className="yhqxz">设置收货地址</Text>
					<Image mode="widthFix" className='line' src={line}></Image>
				</View>
				<View className='address' style={address!=''?'display:block;':'display:none'}  onClick={this.open.bind(this,'/pages/my/address','order')}>
					<Image mode="widthFix" className='yhqjt' src="https://minichat.g2ma.com/kedouimg/goselect.png"></Image>
					<View className="address-con">
						<View className="address-con-h3">
							<Text className="mz">{address.name}</Text>
							<Text className="sj">{address.mobile}</Text>
						</View>
						<View className="address-con-dz">{address.regionName}{address.address}</View>
					</View>
					<Image mode="widthFix" className='line' src={line}></Image>
				</View>
			</View>
			<View className='buygoods'>
				<View className='tit'>共{goodslist.length}件商品</View>
				<View className='buygoods-list'>
					<View className='shopcar-li'>
					{goodslist.map((item, index) => (
						<View className='goods-li'>
							<View className='cat-li-img'>
								<Image className="cat-img" mode='scaleToFill' src={item.logoUrl?item.logoUrl:'https://minichat.g2ma.com/kedouimg/A6984900727459logo.png'}></Image>
							</View>
							<View className='sp-info'>
								<Text className='sp-name'>{item.name}</Text>
								<Text className='sp-gg'>{item.ggname?item.ggname:'默认规格'}</Text>
								<Text className='sp-jg' style={this.state.malltype==''?'':'display:none'}>￥{item.price/100}</Text>
								<Text className='sp-jg' style={this.state.malltype=='UC'?'':'display:none'}>UC{item.price/100}</Text>
								<Text className='sp-jg' style={this.state.malltype=='WUC'?'':'display:none'}>WUC{item.price/100}</Text>
							</View>
							<View className='choose-sl'>x{item.amount}</View>
						</View>
					))}
					</View>
				</View>
			</View>
			<View className='useryhq'>
				<View className="order-yhq" onClick={this.chooseyhq.bind(this)} style={this.state.malltype==''?'':'display:none;'}>
					<Image mode="widthFix" className='yhqjt' src="https://minichat.g2ma.com/kedouimg/goselect.png"></Image>
					<Text className="yhqxz">{yhqname?yhqname:'请选择'}</Text>
					<Text>优惠券</Text>
				</View>
				<View className="order-yhq" style={member.id&&this.state.malltype==''?'':'display:none;'}>
					<Text className="yhqxz">{member.level.name}/{member.level.discount/100}折</Text>
					<Text>会员折扣</Text>
				</View>
				<View className="order-yhq">
					<Text className="yhqxz">{kdf/100}</Text>
					<Text>快递费</Text>
				</View>
			</View>
			
			<View className='dk-box' style={dklist&&dklist.length>0?'':"display:none"} >
        	{dklist.map((item, index) => (
        	<View className='dk-dl' style={item.deductionAmount>0?'':"display:none"} onClick={this.dkchoose.bind(this,index,item.payTypeId)}>
        		<View className='dk-dt'><Image mode='widthFix' className='img' src={score}></Image></View>
        		<View className='dk-dd'>可用{item.deductionAmount/100}{this.dotype(item.payTypeId)}抵用{item.deductionAmount/100}费用</View>
        		<View className='dk-dds'><Image mode='widthFix' className='img' src={this.state.dkarr.indexOf(item.payTypeId)>=0?lbicon:lbicon2}></Image></View>
        	</View>
        	))}
      </View>
			
			<View className='paytype' style="padding-bottom:0">
				<View className='tit'>支付方式</View>
				<View className='qun-bmgue'  onClick={this.choosepay.bind(this,125)} style={!this.state.malltype?'':'display:none'}>
				  <View classNme='qun-zifans'>
					<View className='qun-zifuli'>
					  <View className='qun-fasi'>
						<Image mode="scaleToFill" className='qun-fsimg' src="https://minichat.g2ma.com/kedouimg/icon26.png"></Image>
						<View className='qun-wexm'>
						  <Text>微信支付</Text>
						</View>
					  </View>
					  <Image className='qun-bmbgtu'  src={this.state.paytype==125?'https://minichat.g2ma.com/kedouimg/icon24.png':'https://minichat.g2ma.com/kedouimg/icon23.png'}></Image>
					</View>
				  </View>
				</View>
				<View className='qun-bmgue'  onClick={this.choosepay.bind(this,10)} style={!this.state.malltype?'':'display:none'}>
				  <View classNme='qun-zifans'>
					<View className='qun-zifuli'>
					  <View className='qun-fasi'>
						<Image mode="scaleToFill" className='qun-fsimg' src="https://minichat.g2ma.com/kedouimg/icon28.png"></Image>

						<View className='qun-wexm'>
						  <Text>余额支付</Text>
						</View>
					  </View>
					  <Image className='qun-bmbgtu'  src={this.state.paytype==10?'https://minichat.g2ma.com/kedouimg/icon24.png':'https://minichat.g2ma.com/kedouimg/icon23.png'}></Image>
					</View>
				  </View>
				</View>

				<View className='qun-bmgue' onClick={this.choosepay.bind(this,12)} style={this.state.malltype=='UC'?'':'display:none'}>
				  <View classNme='qun-zifans'>
					<View className='qun-zifuli'>
					  <View className='qun-fasi'>
						<Image mode="scaleToFill" className='qun-fsimg' src="https://minichat.g2ma.com/kedouimg/icon28.png"></Image>
						<View className='qun-wexm'>
						  <Text>UC余额支付</Text>
						</View>
					  </View>
					  <Image className='qun-bmbgtu'  src='https://minichat.g2ma.com/kedouimg/icon24.png'></Image>
					</View>
				  </View>
				</View>
				
				<View className='qun-bmgue' onClick={this.choosepay.bind(this,13)} style={this.state.malltype=='WUC'?'':'display:none'}>
				  <View classNme='qun-zifans'>
					<View className='qun-zifuli'>
					  <View className='qun-fasi'>
						<Image mode="scaleToFill" className='qun-fsimg' src="https://minichat.g2ma.com/kedouimg/icon28.png"></Image>
						<View className='qun-wexm'>
						  <Text>WUC支付</Text>
						</View>
					  </View>
					  <Image className='qun-bmbgtu'  src='https://minichat.g2ma.com/kedouimg/icon24.png'></Image>
					</View>
				  </View>
				</View>
			</View>
			
			<View className='paytype' style={(this.state.malltype=='WUC'||this.state.malltype=='UC')&&kdf>0?'padding-bottom:0':'display:none'}>
				<View className='tit'>邮费支付方式({kdf/100}元)</View>
				<View className='qun-bmgue'  onClick={this.choosepay.bind(this,125)}>
				  <View classNme='qun-zifans'>
					<View className='qun-zifuli'>
					  <View className='qun-fasi'>
						<Image mode="scaleToFill" className='qun-fsimg' src="https://minichat.g2ma.com/kedouimg/icon26.png"></Image>
						<View className='qun-wexm'>
						  <Text>微信支付</Text>
						</View>
					  </View>
					  <Image className='qun-bmbgtu'  src={this.state.paytype==125?'https://minichat.g2ma.com/kedouimg/icon24.png':'https://minichat.g2ma.com/kedouimg/icon23.png'}></Image>
					</View>
				  </View>
				</View>
				<View className='qun-bmgue'  onClick={this.choosepay.bind(this,10)}>
				  <View classNme='qun-zifans'>
					<View className='qun-zifuli'>
					  <View className='qun-fasi'>
						<Image mode="scaleToFill" className='qun-fsimg' src="https://minichat.g2ma.com/kedouimg/icon28.png"></Image>

						<View className='qun-wexm'>
						  <Text>余额支付</Text>
						</View>
					  </View>
					  <Image className='qun-bmbgtu'  src={this.state.paytype==10?'https://minichat.g2ma.com/kedouimg/icon24.png':'https://minichat.g2ma.com/kedouimg/icon23.png'}></Image>
					</View>
				  </View>
				</View>
				
			</View>
			
			<View style="height:120rpx;width:100%;"></View>
			
			<View className='goods-btn' onClick={this.pay.bind(this,3)}>
				<Text className='buynow'>立即结算</Text>
				合计：
				<Text className='car-pri' style="float:none;">￥{(total/100).toFixed(2)}</Text>
			</View>
		</View>
      </View>
    )
  }
}
